package com.ajieee.merge.exception;

import com.ajieee.merge.enums.common.ResultCode;
import lombok.Getter;
import lombok.Setter;

/**
 * @author ajieee
 * @date 2025-11-01
 */
@Setter
@Getter
public class BizWarnException extends RuntimeException {

	private int code;

	public BizWarnException(String message) {
		super(message);
		this.code = ResultCode.BIZ_PROCESS_ERROR.getCode();
	}

	public BizWarnException(int code, String message) {
		super(message);
		this.code = code;
	}

	/**
	 * 数据重复
	 */
	public static BizWarnException dataRepeated(String message) {
		return new BizWarnException(ResultCode.DATA_REPEATED.getCode(), message);
	}

	/**
	 * 参数错误
	 */
	public static BizWarnException paramError(String message) {
		return new BizWarnException(ResultCode.PARAM_ERROR.getCode(), message);
	}

}
